9th international ABINIT developer workshop
20-22nd May 2019 - Louvain-la-Neuve, Belgium

Use the Space key to navigate through all slides.

Using pip and python wheels:
pip install abipy --user
Using conda (recommended):
conda install abipy --channel abinit
From the github repository (develop mode):
git clone https://github.com/abinit/abipy.git
cd abipy
python setup.py develop
For further info see http://abinit.github.io/abipy/installation.html
%embed https://abinit.github.io/abipy/index.html
%embed https://nbviewer.jupyter.org/github/abinit/abitutorials/blob/master/abitutorials/index.ipynb
abistruct.py --help for manpageabistruct.py COMMAND --help for help about COMMAND
abistruct.py spglib si_scf_GSR.nc
abistruct.py convert si_scf_GSR.nc -f cif
abiopen.py si_scf_GSR.nc --print
gsr = abiopen("si_nscf_GSR.nc")
gsr.ebands.plotly(with_gaps=True);
#gsr.ebands.plotly_with_edos(abidata("si_scf_GSR.nc"));
gsr.ebands.kpoints.plotly();
abilab.abipanel()
<module 'panel' from '/Users/gmatteo/miniconda3/envs/env3.7/lib/python3.7/site-packages/panel/__init__.py'>
gsr.get_panel()
gsr.structure.get_panel()
ddb = abilab.abiopen("ZnSe_hex_qpt_DDB")
ddb.get_panel()
abiopen.py mgb2_kpath_FATBANDS.nc --expose --seaborn

!abiopen.py gs_dfpt.abo -p
Traceback (most recent call last):
File "/Users/gmatteo/miniconda3/envs/env3.8/bin/abiopen.py", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/Users/gmatteo/git_repos/abipy/abipy/scripts/abiopen.py", line 347, in <module>
sys.exit(main())
File "/Users/gmatteo/miniconda3/envs/env3.8/lib/python3.8/site-packages/monty-2021.3.3-py3.8.egg/monty/functools.py", line 405, in wrapper
sys.exit(main())
File "/Users/gmatteo/git_repos/abipy/abipy/scripts/abiopen.py", line 213, in main
raise RuntimeError("%s: no such file" % options.filepath)
RuntimeError: gs_dfpt.abo: no such file
!abiopen.py run.log -p
Traceback (most recent call last):
File "/Users/gmatteo/miniconda3/envs/env3.8/bin/abiopen.py", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/Users/gmatteo/git_repos/abipy/abipy/scripts/abiopen.py", line 347, in <module>
sys.exit(main())
File "/Users/gmatteo/miniconda3/envs/env3.8/lib/python3.8/site-packages/monty-2021.3.3-py3.8.egg/monty/functools.py", line 405, in wrapper
sys.exit(main())
File "/Users/gmatteo/git_repos/abipy/abipy/scripts/abiopen.py", line 213, in main
raise RuntimeError("%s: no such file" % options.filepath)
RuntimeError: run.log: no such file

!abistruct.py convert si_scf_GSR.nc -f cif
# generated using pymatgen data_Si _symmetry_space_group_name_H-M 'P 1' _cell_length_a 3.86697464 _cell_length_b 3.86697464 _cell_length_c 3.86697464 _cell_angle_alpha 60.00000000 _cell_angle_beta 60.00000000 _cell_angle_gamma 60.00000000 _symmetry_Int_Tables_number 1 _chemical_formula_structural Si _chemical_formula_sum Si2 _cell_volume 40.88829233 _cell_formula_units_Z 2 loop_ _symmetry_equiv_pos_site_id _symmetry_equiv_pos_as_xyz 1 'x, y, z' loop_ _atom_site_type_symbol _atom_site_label _atom_site_symmetry_multiplicity _atom_site_fract_x _atom_site_fract_y _atom_site_fract_z _atom_site_occupancy Si Si0 1 0.00000000 0.00000000 0.00000000 1 Si Si1 1 0.25000000 0.25000000 0.25000000 1
abiview.py ddb ZnSe_hex_qpt_DDB --seaborn

!abicomp.py structure *.cif si_nscf_GSR.nc `find . -name *_DDB`
zsh:1: no matches found: *.cif
find inside backticks (bash rocks!)¶paths = [
"mgb2_888k_0.01tsmear_DDB",
"mgb2_888k_0.04tsmear_DDB",
"mgb2_121212k_0.01tsmear_DDB",
"mgb2_121212k_0.04tsmear_DDB",
]
paths = [os.path.join(abidata.dirpath, "refs", "mgb2_phonons_nkpt_tsmear", f)
for f in paths]
robot = abilab.DdbRobot()
for i, path in enumerate(paths):
robot.add_file(path, path)
# Define function to change labels:
func = lambda ddb: "nkpt: %s, tsmear: %.2f" % (
ddb.header["nkpt"], ddb.header["tsmear"])
robot.remap_labels(func)
robot
robot.get_params_dataframe()
| nkpt | nsppol | ecut | tsmear | occopt | ixc | nband | usepaw | |
|---|---|---|---|---|---|---|---|---|
| nkpt: 256, tsmear: 0.01 | 256 | 1 | 35.0 | 0.01 | 4 | 1 | 8 | 0 |
| nkpt: 256, tsmear: 0.04 | 256 | 1 | 35.0 | 0.04 | 4 | 1 | 8 | 0 |
| nkpt: 864, tsmear: 0.01 | 864 | 1 | 35.0 | 0.01 | 4 | 1 | 8 | 0 |
| nkpt: 864, tsmear: 0.04 | 864 | 1 | 35.0 | 0.04 | 4 | 1 | 8 | 0 |
robot.get_lattice_dataframe()
| formula | natom | alpha | beta | gamma | a | b | c | volume | abispg_num | spglib_symb | spglib_num | spglib_lattice_type | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| nkpt: 256, tsmear: 0.01 | Mg1 B2 | 3 | 90.0 | 90.0 | 120.0 | 3.086 | 3.086 | 3.523 | 29.055953 | 0 | P6/mmm | 191 | hexagonal |
| nkpt: 256, tsmear: 0.04 | Mg1 B2 | 3 | 90.0 | 90.0 | 120.0 | 3.086 | 3.086 | 3.523 | 29.055953 | 0 | P6/mmm | 191 | hexagonal |
| nkpt: 864, tsmear: 0.01 | Mg1 B2 | 3 | 90.0 | 90.0 | 120.0 | 3.086 | 3.086 | 3.523 | 29.055953 | 0 | P6/mmm | 191 | hexagonal |
| nkpt: 864, tsmear: 0.04 | Mg1 B2 | 3 | 90.0 | 90.0 | 120.0 | 3.086 | 3.086 | 3.523 | 29.055953 | 0 | P6/mmm | 191 | hexagonal |
# Invoke anaddb and store results
r = robot.anaget_phonon_plotters(nqsmall=2)
r.phbands_plotter.gridplot_with_hue("tsmear", with_dos=True);
multi = abilab.ebands_input(structure="si.cif",
pseudos="14si.pspnc",
ecut=8,
spin_mode="unpolarized",
smearing=None,
dos_kppa=5000)
multi.get_vars_dataframe("kptopt", "iscf", "ngkpt")
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-23-bb8704306b8e> in <module> 4 spin_mode="unpolarized", 5 smearing=None, ----> 6 dos_kppa=5000) 7 8 multi.get_vars_dataframe("kptopt", "iscf", "ngkpt") ~/git_repos/abipy/abipy/abio/factories.py in ebands_input(structure, pseudos, kppa, nscf_nband, ndivsm, ecut, pawecutdg, scf_nband, accuracy, spin_mode, smearing, charge, scf_algorithm, dos_kppa) 235 to be used for the computation of the DOS (None if DOS is not wanted). 236 """ --> 237 structure = Structure.as_structure(structure) 238 239 if dos_kppa is not None and not isinstance(dos_kppa, (list, tuple)): ~/git_repos/abipy/abipy/core/structure.py in as_structure(cls, obj) 172 173 if is_string(obj): --> 174 return cls.from_file(obj) 175 176 if isinstance(obj, collections.abc.Mapping): ~/git_repos/abipy/abipy/core/structure.py in from_file(cls, filepath, primitive, sort) 280 # Invoke pymatgen and change class 281 # Note that AbinitSpacegroup is missing here. --> 282 new = super().from_file(filepath, primitive=primitive, sort=sort) 283 if new.__class__ != cls: new.__class__ = cls 284 ~/miniconda3/envs/env3.7/lib/python3.7/site-packages/pymatgen-2022.0.5-py3.7-macosx-10.7-x86_64.egg/pymatgen/core/structure.py in from_file(cls, filename, primitive, sort, merge_tol) 2426 2427 fname = os.path.basename(filename) -> 2428 with zopen(filename, "rt") as f: 2429 contents = f.read() 2430 if fnmatch(fname.lower(), "*.cif*") or fnmatch(fname.lower(), "*.mcif*"): ~/miniconda3/envs/env3.7/lib/python3.7/site-packages/monty-2021.3.3-py3.7.egg/monty/io.py in zopen(filename, *args, **kwargs) 41 if ext in (".GZ", ".Z"): 42 return gzip.open(filename, *args, **kwargs) ---> 43 return io.open(filename, *args, **kwargs) 44 45 FileNotFoundError: [Errno 2] No such file or directory: 'si.cif'
abinp.py ebands mp-149
Use AbiPy programmatic interface to implement: